<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var numPairs = function (time) {
      var x = 0
      for (var i = 0; i < time.length; i++) {
        for (var j = i + 1; j < time.length; j++) {
          var arr = (time[i] + time[j]) % 60
          if (arr == 0) {
            x++
          }
        }
      }
      return x;
    };
    console.log(numPairs(time = [60, 60, 60])) 
  </script>

</body>

</html>